import * as types from './types'
let initState =  {
  count:100
}
//两个作用 1  给是初始数据  2， 更新数据
export function countReducer(state,option){
  state = state || initState;
  switch (option.type) {
    case types.ADD:
      return {
        ...state,
        count:state.count + option.count
      }
    case types.MINUS:
      return {
        ...state,
        count:state.count - option.count
      }
  
    default:
      return {
        ...state
      }
      break;
  }
}